/*
 * G2P_CloseMatch.cpp
 *
 *  Created on: Feb 13, 2013
 *      Author: think
 */
#include "g2p_close_match.h"
#include "stdio.h"
int map_code[46] = { 3, 7, 7, 7, 7, 7, 12, 2, 15, 15, 15, 15, 18, 9, 1, 6, 9, 6,
		11, 9, 1, 6, 6, 6, 11, 8, 0, 5, 14, 5, 14, 5, 10, 18, 13, 13, 13, 13,
		17, 15, 15, 15, 16, 13, 4, 16 };
int map_code_f[46] = { 2, 1, 1, 1, 1, 1, 5, 1, 1, 1, 1, 1, 6, 1, 1, 1, 1, 1, 3,
		1, 1, 1, 1, 1, 3, 0, 0, 4, 0, 4, 0, 4, 4, 6, 3, 3, 3, 3, 7, 1, 1, 1, 1,
		3, 8, 1 };
int map_code_g[46] = { 2, 1, 0, 4, 4, 4, 4, 2, 1, 4, 4, 4, 4, 2, 3, 1, 4, 4, 4,
		3, 2, 1, 4, 4, 4, 3, 2, 1, 1, 4, 4, 4, 4, 4, 4, 1, 4, 0, 4, 1, 1, 1, 1,
		4, 3, 4 };
signed char con_min = (signed char) 0x81;
signed char con_max = (signed char) 0xae;

int cmatch_getInitConsoCode(signed char c) {

	if (c >= con_min && c <= con_max) {
		return map_code[(int) (c + 127)];
	}
	return -1;
}

int cmatch_getFinalConsoCode(signed char c) {
	if (c >= con_min && c <= con_max) {
		return map_code_f[(int) (c + 127)];
	}
	return -1;
}

int cmatch_getConsoGroup(signed char c) {
	if (c >= con_min && c <= con_max) {
		return map_code_g[(int) (c + 127)];
	}
	return -1;
}
